Ext.define('truckplanner.controller.Application', {
    extend: 'Ext.app.Controller',
    
    views : ['partselection','main','contact.List'],
    
    refs: [
           {ref: 'partselection', selector: 'partselection'},
           {ref: 'mainpanel', selector: 'main'},
           {ref: 'contactList', selector: 'main contactlist'},
           {ref: 'missionMain', selector: 'main missionmain'},
           {ref: 'yardMain', selector: 'main yardmain'}
    ],
    
    init: function() {
    	this.control({
            'partselection button[action=tocontact]': {
                click: this.toContact
            },
            'partselection button[action=tomission]': {
                click: this.toMission
            },
            'partselection button[action=toyard]': {
                click: this.toYard
            }
        });
    },
    
    toContact: function() {
    	//console.log('To contact...');
    	this.getMainpanel().layout.setActiveItem('contact-list');
    },
    
    toMission: function() {
    	//console.log('To mission...');
    	this.getMainpanel().layout.setActiveItem('mission-main');
    },
    
    toYard: function() {
    	//console.log('To yard...');
    	this.getMainpanel().layout.setActiveItem('yard-list');
    }
});